package com.guicent.geekai.config;

import feign.RequestInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 外部配置
 *
 * @author xiaojiang
 * @date 2025/03/17
 */
@Configuration
public class FeignConfig {

    @Value("${geekai.api-key}")
    private String apiKey;

    @Bean
    public RequestInterceptor requestInterceptor() {
        return requestTemplate -> {
            // 请替换 <YOUR_GEEKAI_API_KEY> 为你实际的 API Key
            requestTemplate.header("Authorization", "Bearer " + apiKey);
            requestTemplate.header("Content-Type", "application/json");
        };
    }
}
